Development Build

What is development build?
React native app consists of 2 parts:
  1. Native app bundle: Which is installed on physical device
  2. Javascript bundle: that runs inside it Expo Go app serves itself as Native app bundle.
In development build we will be creating native app bundle ourself instead of relying on already published app(like expo Go) This provides full control over native runtime allowing to install native libraries, even write our own native code.

Ways to create development build:
  1. Build on Cloud: EAS(Expo Application services) build app on cloud and install on real device
 2. Build locally: Run on Andriod Studio or XCode(ios) locally on laptop

Expo Go Build vs Development Build

Expo Go build Development build
Install some 3rd party libraries(ie Community developed) No Yes
Sandbox Yes No
production ready No Yes
Support functionalities(Notification, Oauth authentication, analytics) No Yes

1. Create dev build on Cloud. Expo Application Services (EAS)

Cloud-based tools and services that helps building, deploying React Native apps
You can build app on cloud, then download and install directly on mobile or distribute: apk/aab(Andriod), ipa(IOS)
We can create local build using EAS
EAS has hosted servers in cloud to build your app

Steps of creating apk using EAS (cloud)


//Install eas cli(EAS CLI is the command-line app that you will use to interact with EAS services from your terminal)
$ npm install -g eas-cli    

//Log in to Expo using your username, password
$ eas login
$ eas whoami

//Initialize EAS in Your Project 
$ eas init

// Create a development build, which is a debug build of your app
$ npx expo install expo-dev-client


$ eas build -p android --profile development    // Andriod development build

$ eas build -p ios --profile development        // ios development build
This will upload project on cloud
where its build an signed

After the build completes, download the APK/IPA and install it on your device
      

2. Create dev build locally. expo-dev-client


Install Android Studio and/or Xcode.
Ensure you have Node.js and npm installed.
$ npx create-expo-app@latest        //Create project
$ cd my-app
$ npx expo install expo-dev-client

// expo-cli is not required to be installed. This was used for classic expo workflow

//This command creates the /android and /ios directories
// converting your project to Expo's bare workflow.
// Expo cannot generate the ios directory unless you are on macOS with Xcode installed.
$ npx expo prebuild     //Generate Native Code (Prebuild)

$ npx expo run:android